﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PSE.Tools.SchemaComparer.Extractor
{
    public static class TypeExtension
    {
        /// <summary>
        /// Metodo atraves do qual é possivel verificar se um tipo é Nullable
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static bool IsNullable(this Type type)
        {
            if (type == null)
                throw new ArgumentException("The parameter canot be null", "type");

            return (type.IsGenericType && (type.GetGenericTypeDefinition() == typeof(System.Nullable<>)));
        }
    }
}
